package com.wk1un2.service.impl;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wk1un2.entity.ShoppingCart;
import com.wk1un2.mapper.ShoppingCartMapper;
import com.wk1un2.service.ShoppingCartService;

@Service
public class ShoppingCartServiceImpl implements ShoppingCartService {
	@Autowired
	private ShoppingCartMapper ShoppingCartMapper;// 自动注入mapper

	@Override
	public List<Map<String, Object>> getAll(int page, int limit, Integer u_id,String sc_id) {
		// TODO Auto-generated method stub
		List<String> idList=null;
		if (sc_id!=null) {
		idList = Arrays.asList(sc_id.split(","));
		}
		return ShoppingCartMapper.getAll(page, limit, u_id,idList);
	}

	@Override
	public Integer add(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return ShoppingCartMapper.add(map);
	}

	@Override
	public Integer update(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return ShoppingCartMapper.update(map);
	}

	@Override
	public Integer delete(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return ShoppingCartMapper.delete(map);
	}

	@Override
	public Integer count() {
		// TODO Auto-generated method stub
		return ShoppingCartMapper.count();
	}
	@Override
	public int deleteshop(String sc_id) {
		// TODO Auto-generated method stub
		List<String> idList = Arrays.asList(sc_id.split(","));
		return ShoppingCartMapper.deleteshop(idList);
	}
}
